package tests;

import java.util.LinkedList;
import java.util.List;

import common.Board;
import common.Coordinate;
import common.Tile;
import common.enumCompany;

import junit.framework.TestCase;

public class BoardTest extends TestCase{
	
	Board board;
	enumCompany comp;
	
	
	protected void setUp() {
		List<Tile> tileList = new LinkedList<Tile>();
		for(int i=0; i<9; i++) {
            for(int j=0; j<12; j++) {
                tileList.add(new Tile(new Coordinate(i,j)));
            }
        }
		board = new Board(tileList);
		comp = enumCompany.FUSION;
    }
	
	public void testGetTile() {
		assertEquals(3,board.getTile(3,7).getLocation().getX());
		assertEquals(7,board.getTile(3,7).getLocation().getY());
		Coordinate coord = new Coordinate(3,7);
		assertEquals(3,board.getTile(coord).getLocation().getX());
		assertEquals(7,board.getTile(coord).getLocation().getY());
	}


	public void testIsCompanyOnBoard(){
		boolean a = board.isCompanyOnBoard(comp);
		assertTrue(!a);
	}
	
	public void testPutCompanyOnBoard() {
		boolean a = board.isCompanyOnBoard(comp);
		board. setCompanyOnBoard(comp, true);
		a = board.isCompanyOnBoard(comp);
		assertTrue(a);
	}
	
	public void testnumOfCompaniesOnBoard(){
		assertEquals(0,board.numOfCompaniesOnBoard());
		board. setCompanyOnBoard(comp, true);
		assertEquals(1,board.numOfCompaniesOnBoard());
	}
	
	protected void tearDown() {}
	
}
